import numpy as np
import matplotlib.pyplot as plt
from sko.GA import GA
from sko.tool_kit import x2gray


def cal_fitness(chome):
    print(chome)
    print('-')

    total_fitness_val = 1
    return total_fitness_val


if __name__ == '__main__':
    # 流水车间调度，3个总装台，每个总装台5个工序，一共5个订单
    order_info = [
        ['A', '001', 20],
        ['A', '002', 20],
        ['B', '003', 20],
        ['B', '004', 20],
        ['A', '005', 20],
    ]
    # 3个总装台，每个总装台分别对五个订单的制造时间
    order_product_cost = np.asarray([
        [17, 17, 21, 21, 17], [18, 18, 18, 18, 18], [16, 16, 17, 17, 16]
    ])
    # 编码方式：实值编码，[2,10,]表示1号总装台装订单2，从第10个小时开始,
    # 这是约束，目前暂无约束
    constraint_eq = [
        # 等式约束条件：
    ]
    constraint_ueq = [
        # 不等式约束条件：
    ]
    ga = GA(func=cal_fitness, n_dim=3, size_pop=50, max_iter=100,
            lb=[0, 0, 0], ub=[3, 4, 23], constraint_eq=constraint_eq,
            constraint_ueq=constraint_ueq, precision=[1, 1, 1])
    best_x, best_y = ga.run()
